class MyRect {
  constructor(options) {
    this.translateX = options.translateX || 0
    this.translateY = options.translateY || 0
    this.width = options.width || 0
    this.height = options.height || 0

    this.rotation = options.rotation || 0
    this.opacity = options.opacity || 1
    this.scaleX = options.scaleX || 1
    this.scaleY = options.scaleY || 1

    this.strokeStyle = options.strokeStyle || 'red'
    this.fillStyle = options.fillStyle || 'blue'
  }

  render(context) {
    context.save()
    context.beginPath()
    context.translate(this.translateX, this.translateY)

    context.rotate((Math.PI / 180) * this.rotation)

    context.globalAlpha = this.opacity

    context.scale(this.scaleX, this.scaleY)

    context.rect(0, 0, this.width, this.height)

    context.fillStyle = this.fillStyle
    context.fill()
    context.strokeStyle = this.strokeStyle
    context.stroke()

    context.restore()
  }
}
